package com.xxlie.auth.security.auth.ajax;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;

/**
 * 登录请求
 * LoginRequest
 *
 * @author xxlie.com
 * @since 2017/7/30
 */
public class LoginRequest {
    private String username;
    private String password;
    private Map<String, Object> extraParams;

    @JsonCreator
    public LoginRequest(@JsonProperty("username") String username, @JsonProperty("password") String password, @JsonProperty("extraParams") Map<String, Object> extraParams) {
        this.username = username;
        this.password = password;
        this.extraParams = extraParams;
    }

    @NotNull(message = "登录账号不能为空")
    @Length(min = 5, max = 15, message = "请输入正确数位的登陆账户")
    public String getUsername() {
        return username;
    }

    @NotNull(message = "密码不能为空")
    @Length(min = 6, max = 20, message = "密码长度在6-20位数之间")
    public String getPassword() {
        return password;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Map<String, Object> getExtraParams() {
        return extraParams;
    }

    public void setExtraParams(Map<String, Object> extraParams) {
        this.extraParams = extraParams;
    }

}
